<!DOCTYPE html>
<html>
<head>
<include file="Include:meta" />
<title>个人资料-目的地运营集团数据管理平台</title>
<include file="Include:style" />
</head>
<body>
<include file="Include:header" />
<include file="Include:left" />
<div id="main">
	<div class="crumbs">
		<div class="crumbs-text">个人资料</div>
	</div>
	<div id="content">
		<form action="__APP__/System/personal_data" method="post" name="number_validate" id="password_validate" novalidate="novalidate" />
			<input type="hidden" name="action" value="edit">
			<div class="form-main">
				<div class="form-title">个人资料</div>
				<div class="form-item">
					<div class="input-label">姓名</div>
					<div class="input-item">{$user['username']}</div>
				</div>
				<div class="form-item">
					<div class="input-label"><span class="asterisk">*</span>登录用户名</div>
					<div class="input-item">
						<input type="text" name="regname" value="{$user['regname']}" class="form-control required-text" autocomplete="off">
						<span class="error-item">必填项</span>
						<span class="error-item">长度只能在2-20个字符之间</span>
						<span class="error-item">格式错误，仅支持汉字、字母、数字、“-”“_”的组合</span>
						<div class="input-prompt"><i class="glyphicon glyphicon-exclamation-sign"></i> 支持中文、字母、数字、“-”“_”的组合，2-20个字符</div>
					</div>
				</div>
				<div class="form-item">
					<div class="input-label"><span class="asterisk">*</span>密码</div>
					<div class="input-item">
						<input type="password" name="password" id="password" class="form-control" value="{$user['password']}" maxlength="20" autocomplete="off">
						<span class="error-item">必填项</span>
						<span class="error-item">不能含有空格</span>
						<span class="error-item">长度只能在6-20个字符之间</span>
						<div class="input-prompt"><i class="glyphicon glyphicon-exclamation-sign"></i> 6-20个字符</div>
					</div>
				</div>
				<div class="form-item">
					<div class="input-label"><span class="asterisk">*</span>确认密码</div>
					<div class="input-item">
						<input type="password" name="confirm_password" id="confirm_password" class="form-control" value="{$user['password']}" maxlength="20" autocomplete="off">
						<span class="error-item">必填项</span>
						<span class="error-item">两次密码不一致</span>
					</div>
				</div>
				<div class="form-item">
					<div class="input-label">员工号</div>
					<div class="input-item">
						{$user['empl_id']}
					</div>
				</div>
				<div class="form-item">
					<div class="input-label">手机号</div>
					<div class="input-item">
						{$user['mobilephone']}
					</div>
				</div>
				<div class="form-item">
					<div class="input-label">邮箱</div>
					<div class="input-item">
						{$user['email']}
					</div>
				</div>
				<div class="form-item">
					<div class="input-label">所属中心</div>
					<div class="input-item">
						{$user['center']}
					</div>
				</div>
				<div class="form-item">
					<div class="input-label">部门</div>
					<div class="input-item">
						{$user['deps']}
					</div>
				</div>
				<div class="form-item">
					<div class="input-label">职位</div>
					<div class="input-item">
						{$user['position_descr']}
					</div>
				</div>
				<div class="form-item">
					<div class="input-label">职级</div>
					<div class="input-item">
						{$user['rank_descr']}
					</div>
				</div>
				<div class="form-item">
					<div class="input-label">微信公众号</div>
					<div class="input-item">
						<if condition="$user['openid'] neq NULL"><a href='javascript:;' class="cancle_openid" action="delete">解除绑定</a><else />未绑定<div class="input-prompt"><i class="glyphicon glyphicon-exclamation-sign"></i> 如需绑定，请进入微信公众号“景域目的地运营集团数据管理平台”或扫描首页二维码，点击数据平台，登录，即可绑定。</div></if>
					</div>
				</div>
			</div>
			<div class="form-btn-item"><button class="btn submit" type="submit">提交</button></div>
		</form>
	</div>
</div>
<include file="Include:javascript" />
<script type="text/javascript">
$(function() {
	//解除绑定
	$(".cancle_openid").ajaxModal({"title_text":"确认提示框","body_text":"您确定要解除绑定微信公众号吗？","url":"__APP__/System/personal_ajax","data":{"action":"action"}});

	//提交验证
	$(".submit").click(function(){
		var tag = false;
		
		$("[name='regname']").each(function(){
			var $val = $(this).val();
			if($val==""){
				$(this).nextAll(".error-item").eq(0).show();
				tag = true;
			}else if($val.length<2){
				$(this).nextAll(".error-item").eq(1).show();
				tag = true;
			}else if(!/^[\u4E00-\u9FA5A-Za-z0-9_-]+$/.test($val)){
				$(this).nextAll(".error-item").eq(2).show();
				tag = true;
			}
		});
		$("[name='password']").each(function(){
			var $val = $(this).val();
			if($val==""){
				$(this).nextAll(".error-item").eq(0).show();
				tag = true;
			}else if(/\s/.test($val)){
				$(this).nextAll(".error-item").eq(1).show();
				tag = true;
			}else if($val.length<6){
				$(this).nextAll(".error-item").eq(2).show();
				tag = true;
			}
		});
		$("[name='confirm_password']").each(function(){
			var $val = $(this).val(),
				$psw = $("[name='password']").val();
			if($val==""){
				$(this).nextAll(".error-item").eq(0).show();
				tag = true;
			}else if($psw!="" && $psw!=$val){
				$(this).nextAll(".error-item").eq(1).show();
				tag = true;
			}
		});
		$("[name='email']").each(function(){
			var $val = $(this).val();
			if($val!="" && !/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test($val)){
				$(this).next(".error-item").show();
				tag = true;
			}
		});
		$("[name='mobilephone']").each(function(){
			var $val = $(this).val();
			if($val!="" && !/^1[3|4|5|7|8]\d{9}$/.test($val)){
				$(this).next(".error-item").show();
				tag = true;
			}
		});
		
		if(tag){
			return false;
		}
	});
	//隐藏错误提示
	$("[name='password'],[name='confirm_password'],[name='mobilephone'],[name='email'],[name='regname']").focus(function(){
		$(this).nextAll(".error-item").hide();
	});
});
</script>
</body>
</html>
